package edu.sias.hyznxfapi.controller;


import edu.sias.hyznxfapi.pptMade.utils.api.PPTGenerator;
import edu.sias.hyznxfapi.vo.PptVO;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/xfapi/pptMade")
public class PptMageController {

    /**
     *
     * @param request
     * @return
     */
    @PostMapping()
    public String getPpt(@RequestBody PptVO request){
        System.out.println("打印一下" + request.getQuery());
        System.out.println("打印一下" + request.getAuthor());
        System.out.println("打印一下" + request.getTheme());
        PPTGenerator generator = new PPTGenerator();
        String s = null;
        try {
            s = generator.generatePPT(request.getQuery(),request.getAuthor(),request.getTheme());
            System.out.println("打印一下" + s);
        } catch (InterruptedException e) {
            s =  "系统开小差了！请耐心等待或联系工作人员";
            throw new RuntimeException(e);
        }
        System.out.println("打印一下" + s);
        return s;

    }
}
